package com.onefish.toolkit.controller;

import com.onefish.toolkit.annotation.RateLimited;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/rateLimiter")
public class RateLimitController {
    @RateLimited(specialOption = true,permitsPerSecond = 0.25)
    @GetMapping("/test")
    public String test(HttpServletRequest request) {
        // 业务逻辑
        return "Hello, Rate Limited World!";
    }
}
